<template>
	<view class="container">
		<view class="notice-box" v-for="(item,index) in newslist" @click="to(item)">
			<image :src="item.noticeImage" mode=""></image>
			<view class="title">{{item.noticeTitle}}</view>
			<view class="time">
				<image src="../../../static/index/time.png" mode=""></image>
				<view>{{$u.timeFormat(item.updateTime, 'yyyy-mm-dd hh:MM')}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {getnews}from"../../../api/index.js"
	export default{
		data(){
			return{
				newslist:[],
				num:1
			}
		},
		onLoad() {
			this.getnews()
		},
		onReachBottom() {
			this.getnews()
		},
		methods:{
			// 获取新闻展示
			async getnews(){
				let res=await this.get(getnews,{pageNum:this.num,pageSize:10,type:3})
				this.num++
				this.newslist=[...this.newslist,...res.data]
			},
			to(item){
				uni.setStorageSync("news",item)
				uni.navigateTo({
					url:"./noticeDetail"
				})
			}
		}
	}
</script>

<style lang="less">
	page{
		background-color: #F5F5F5;
	}
	.container{
		padding: 30rpx;
	}
	.notice-box{
		width: 690rpx;
		height: 500rpx;
		background: #FFFFFF;
		box-shadow: 0px 4rpx 10rpx rgba(0, 0, 0, 0.16);
		border-radius: 12rpx;
		overflow: hidden;
		margin-bottom: 30rpx;
		image{
			width: 690rpx;
			height: 377rpx;
		}
	}
	.title{
		margin: 10rpx 0 0 20rpx;
		font-size: 30rpx;
		font-weight: bold;
		color: #333333;
		text-overflow: ellipsis;
		overflow: hidden;
		white-space: nowrap;
	}
	.time{
		display: flex;
		align-items: center;
		margin: 15rpx 0 0 20rpx;
		image{
			width: 20rpx;
			height: 20rpx;
			margin-right: 6rpx;
		}
		font-size: 20rpx;
		color: #999999;
		line-height: 20rpx;
	}
</style>
